﻿<phone:PhoneApplicationPage xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:wp7cinema_ViewModel="clr-namespace:wp7cinema.ViewModel" xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP7" xmlns:ic="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions" x:Class="wp7cinema.View.TicketingInfoView"
                            SupportedOrientations="Portrait"
                            Orientation="Portrait"
                            d:DesignWidth="480"
                            mc:Ignorable="d"
                            d:DesignHeight="768"
                            shell:SystemTray.IsVisible="True"
                            >
	<phone:PhoneApplicationPage.Resources>
		<Style x:Key="MovieItemStyle" TargetType="ListBoxItem">
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="BorderThickness" Value="0"/>
			<Setter Property="BorderBrush" Value="Transparent"/>
			<Setter Property="Padding" Value="0"/>
			<Setter Property="HorizontalContentAlignment" Value="Left"/>
			<Setter Property="VerticalContentAlignment" Value="Top"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ListBoxItem">
						<Border x:Name="LayoutRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="MouseOver"/>
									<VisualState x:Name="Disabled">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="LayoutRoot">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}"/>
											</ObjectAnimationUsingKeyFrames>
											<DoubleAnimation Duration="0" To=".5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentContainer"/>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
								<VisualStateGroup x:Name="SelectionStates">
									<VisualState x:Name="Unselected"/>
									<VisualState x:Name="Selected">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{Binding Title}" FontSize="29.333"/>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="TicketItemStyle" TargetType="ListBoxItem">
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="BorderThickness" Value="0"/>
			<Setter Property="BorderBrush" Value="Transparent"/>
			<Setter Property="Padding" Value="0"/>
			<Setter Property="HorizontalContentAlignment" Value="Left"/>
			<Setter Property="VerticalContentAlignment" Value="Top"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ListBoxItem">
						<Border x:Name="LayoutRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="MouseOver"/>
									<VisualState x:Name="Disabled">
										<Storyboard>
											<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="LayoutRoot">
												<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}"/>
											</ObjectAnimationUsingKeyFrames>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
								<VisualStateGroup x:Name="SelectionStates">
									<VisualState x:Name="Unselected"/>
									<VisualState x:Name="Selected">
										<Storyboard>
											<ColorAnimation Duration="0" To="#FF4760AD" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="textBlock" d:IsOptimized="True"/>
											<ColorAnimation Duration="0" To="#FFADCA64" Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="textBlock1" d:IsOptimized="True"/>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<StackPanel Orientation="Horizontal">
								<TextBlock x:Name="textBlock" TextWrapping="Wrap" Text="{Binding Place}" VerticalAlignment="Top" FontSize="29.333"/>
								<TextBlock x:Name="textBlock1" TextWrapping="Wrap" Text="{Binding Time}" VerticalAlignment="Top" FontSize="29.333" Margin="11,0,0,0"/>
							</StackPanel>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</phone:PhoneApplicationPage.Resources>

	<!-- Sample code showing usage of ApplicationBar
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="appbar_button1" IconUri="/Images/appbar_button1.png" Text="Button 1"></shell:ApplicationBarIconButton>
            <shell:ApplicationBarIconButton x:Name="appbar_button2" IconUri="/Images/appbar_button2.png" Text="Button 2"></shell:ApplicationBarIconButton>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem x:Name="menuItem1" Text="MenuItem 1"></shell:ApplicationBarMenuItem>
                <shell:ApplicationBarMenuItem x:Name="menuItem2" Text="MenuItem 2"></shell:ApplicationBarMenuItem>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
    -->
	<phone:PhoneApplicationPage.FontFamily>
		<StaticResource ResourceKey="PhoneFontFamilyNormal"/>
	</phone:PhoneApplicationPage.FontFamily>
	<phone:PhoneApplicationPage.FontSize>
		<StaticResource ResourceKey="PhoneFontSizeNormal"/>
	</phone:PhoneApplicationPage.FontSize>
	<phone:PhoneApplicationPage.Foreground>
		<StaticResource ResourceKey="PhoneForegroundBrush"/>
	</phone:PhoneApplicationPage.Foreground>
	<phone:PhoneApplicationPage.DataContext>
		<Binding Path="Main" Source="{StaticResource Locator}"/>
	</phone:PhoneApplicationPage.DataContext>

	<Grid x:Name="LayoutRoot"
	      Background="Transparent">
		<Grid.Projection>
			<PlaneProjection RotationX="-90"/>
		</Grid.Projection>
		<VisualStateManager.VisualStateGroups>
			<VisualStateGroup x:Name="OpenAndClose">
				<VisualStateGroup.Transitions>
					<VisualTransition GeneratedDuration="0:0:0.3"/>
				</VisualStateGroup.Transitions>
				<VisualState x:Name="Open">
					<Storyboard>
						<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)" Storyboard.TargetName="LayoutRoot" d:IsOptimized="True"/>
					</Storyboard>
				</VisualState>
				<VisualState x:Name="Close"/>
				<VisualState x:Name="Back"/>
			</VisualStateGroup>
		</VisualStateManager.VisualStateGroups>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="*" />
		</Grid.RowDefinitions>

		<Custom:Interaction.Triggers>
			<Custom:EventTrigger>
				<ic:GoToStateAction StateName="Open"/>
			</Custom:EventTrigger>
		</Custom:Interaction.Triggers>

		<StackPanel x:Name="TitlePanel"
		            Grid.Row="0"
		            Margin="24,24,0,12">
			<TextBlock x:Name="ApplicationTitle"
			           Text="{Binding ApplicationTitle}"
			           Style="{StaticResource PhoneTextNormalStyle}" />
		</StackPanel>

		<Grid x:Name="ContentGrid"
		      Grid.Row="1">
			<Grid.DataContext>
				<wp7cinema_ViewModel:TicketingInfoViewModel/>
			</Grid.DataContext>
			<TextBlock HorizontalAlignment="Right" TextWrapping="Wrap" VerticalAlignment="Top" Text="날짜" Margin="0,9,18,0" FontSize="26.667" Width="148"/>
			<ListBox x:Name="DateListBox" HorizontalAlignment="Right" Width="150" Margin="0,48,18,0" Height="148" VerticalAlignment="Top" ItemsSource="{Binding EnableDates}" FontSize="29.333">
				<Custom:Interaction.Triggers>
					<Custom:EventTrigger EventName="SelectionChanged">
						<GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding SetDateCommand}" CommandParameter="{Binding SelectedItem, ElementName=DateListBox}"/>
					</Custom:EventTrigger>
				</Custom:Interaction.Triggers>
			</ListBox>
			<TextBlock TextWrapping="Wrap" VerticalAlignment="Top" Text="상영작" Margin="15,9,0,0" FontSize="26.667" HorizontalAlignment="Left" Width="224"/>
			<ListBox x:Name="MovieListBox" Margin="8,48,184,0" Height="148" VerticalAlignment="Top" ItemsSource="{Binding Movies}" ItemContainerStyle="{StaticResource MovieItemStyle}">
				<Custom:Interaction.Triggers>
					<Custom:EventTrigger EventName="SelectionChanged">
						<GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding SetMovieCommand}" CommandParameter="{Binding SelectedItem, ElementName=MovieListBox}"/>
					</Custom:EventTrigger>
				</Custom:Interaction.Triggers>
			</ListBox>
			<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="상영시간" VerticalAlignment="Top" Margin="8,223,0,0" FontSize="26.667"/>
			<ListBox x:Name="TicketListBox" Margin="15,275,8,81" ItemsSource="{Binding Tickets}" ItemContainerStyle="{StaticResource TicketItemStyle}">
				<Custom:Interaction.Triggers>
					<Custom:EventTrigger EventName="SelectionChanged">
						<GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding SetTicketInfo}" CommandParameter="{Binding SelectedItem, ElementName=TicketListBox}"/>
					</Custom:EventTrigger>
				</Custom:Interaction.Triggers>
			</ListBox>
		</Grid>
	</Grid>


</phone:PhoneApplicationPage>